<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class Admin extends  User
{
    use HasApiTokens, HasFactory, Notifiable;
    // use HasFactory, HasApiTokens;

    protected $fillable = [
        'name', 'status', 'password',
    ];
    protected $casts = [
        'status' => 'boolean',
    ];

    //findForPassport方法是用来根据用户名查找用户的方法
    public function findForPassport($username)
    {
        return $this->where('name', $username)->first();
    }
}
